home *** CD-ROM | disk | FTP | other *** search
- Path: news.cac.psu.edu!psuvm!f0o
- Organization: Penn State University
- Date: Fri, 19 Apr 1996 09:39:35 EDT
- From: Tim Benner <F0O@psuvm.psu.edu>
- Message-ID: <96110.093936F0O@psuvm.psu.edu>
- Newsgroups: comp.lang.c
- Subject: Array indexing with malloc
-
- Hi netters!
-
- I write c programs to collect online data, and I always malloc a block
- of memory to hold the data. I set the memory block up such that each
- row is a different time point, and each column is a different channel.
- The formula I use to do this is:
- RawData[CurrentPoint*NumChannels+Channel]
- This works fine, except I don't like having to do the multiplication
- every time I want to access a point in the memory block. I tried setting
- up the memory block by mallocing a structure. This also works, and I
- believe is neater in implementation, but seems to have a limit of about
- 64k. I allocate arrays of around 100k or more.
- My burning question is, can I use a structure rather then the above
- method for accessing large arrays? I'm using Turbo C++ version 3.0, and
- I'm in the large memory model. I'm also setting the pointer to memory
- as a far huge pointer.
-
- [Tim]
-